home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
dbms_mag
/
9104
/
olympia1.apr
< prev
next >
Wrap
Text File
|
1991-02-13
|
3KB
|
87 lines
PROCEDURE MkccMail
************************************************************
* Program ...: MkccMail.prg
* :
* Author ....: P. L. Olympia, Platinum Software Int'l, 11/90
* :
* Language...: FoxPro. Uses low-level file I/O functions.
* :
* Purpose....: Creates a file that can be IMPORTed into
* : cc:Mail as a message. The message file can
* : have a binary file attached to it. In this
* : implementation, the content of the actual
* : message is read from a text file.
* :
* Public Vars: To minimize the number of parameters passed
* : to this procedure, the following public
* : character memvars should have been assigned
* : appropriate values before this procedure is
* : called:
* : MsgFrom = Name of message sender
* : PswdFrom = Password of message sender
* : CCdata = Path/directory where cc:Mail DB is
* :
* Syntax.....: DO MkccMail WITH MsgTo, MsgSubj, MsgImpt,
* : MsgTxt, FileApnd
: :
* Notes .....: This code has minimal error checking
************************************************************
PARA MsgTo, MsgSubj, MsgImpt, MsgTxt, FileApnd
* | | | | |
* | | | | File to append, if any
* | Msg Subject | |
* |_Receiver name | File containing text of msg
* |_ Name of file this pgm creates
*
* Examples:
* MsgTo = "Molly Puffin"
* MsgSubj = "European FoxPro Conference"
* MsgImpt = "A:\ccmail.imp"
* MsgTxt = "D:\ccmail\puffin\foxconf.txt"
* FileApnd = "F:\DBASE\SLIDES.ZIP"
*-- Comment out these 3 lines if you don't need them
SET TALK OFF
CLOSE ALL
CLEAR ALL
fh_out = FCREATE(msgimpt)
IF fh_out < 0
? "Cannot create ", msgimpt
RETU
ENDIF
*-- Write message headers/preamble
writeit = FPUTS(fh_out, "Message:")
writeit = FPUTS(fh_out, "From: " + msgfrom)
writeit = FPUTS(fh_out, "Date: " + DTOC(DATE()) + ;
" " + TIME())
writeit = FPUTS(fh_out, "To: " + msgto)
writeit = FPUTS(fh_out, "Subject: " + msgsubj)
writeit = FPUTS(fh_out, "Contents:")
*-- Write the actual message
IF FILE(msgtxt)
fh_in1 = FOPEN(msgtxt)
DO WHILE ! FEOF(fh_in1)
str = FGETS(fh_in1)
writeit = FPUTS(fh_out, str)
ENDD
=FCLOSE(fh_in1)
ENDIF
*-- If there is a file to be appended, append it now
IF FILE(fileapnd)
writeit = FPUTS(fh_out, "File Item: " + fileapnd)
ENDIF
=FCLOSE(fh_out)
**-- Send the message to cc:Mail
str = msgfrom + SPAC(1) + pswdfrom + SPAC(1) + ccdata + ;
" @" + msgimpt
! /100 IMPORT &str
RETURN